package utilities;

import java.io.File;
import java.io.IOException;

public class GenerateFiles {
	//create a file using a counter
	public static String createFile2() throws IOException{
		int i = 1;
		String fileName = "CAD" + Integer.toString(i) + "_copy" + ".txt";
		File file = new File(fileName);
		while(file.exists()){
			i++;
			fileName = "CAD" + Integer.toString(i) + "_copy" + ".txt";
			file = new File(fileName);
		}
		file.createNewFile();
		return fileName;
	}
	public static String createFile2(String dir) throws IOException{
		int i = 1;
		String fileName = dir + "CAD" + Integer.toString(i) + "_copy" + ".txt";
		File file = new File(fileName);
		while(file.exists()){
			i++;
			fileName = dir + "CAD" + Integer.toString(i) + "_copy" + ".txt";
			file = new File(fileName);
		}
		file.createNewFile();
		return fileName;
	}
}
